home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 5 / CHASSIS_ / CURSORSE.C < prev    next >
Text File  |  1992-05-14  |  2KB  |  69 lines

  1. /************************************************************************************/
  2. /*    CursorSelect                                                                    */
  3. /*                                                                                    */
  4. /*    Controls the choice of cursor.  Executed from main event loop with theWindow,    */
  5. /*  and partNo, or from anywhere else with just the cursorNo.  If all three are     */
  6. /*  NIL, initialize the cursor to the startup arrow.                                */
  7. /*                                                                                    */
  8. /************************************************************************************/
  9.  
  10. #include "MyHeaders.h"
  11.  
  12. int CursorSelect(WindowPtr theWindow, int partNo, int cursorNo)
  13. {
  14.     int            CSRetCode = 0;                                /* set return code        */
  15.     CursHandle    theCursor;                                    /* handle to cursor        */
  16.     TEHandle    myTEdHandle;                                /* work handle            */
  17.  
  18.     if (theWindow)                                            /* if in a window        */
  19.         {
  20.         WorkRetCode = WhichWindow(theWindow, &windSub);        /* find which window    */
  21.         switch (windTbl[windSub].windRec.refCon)            /* switch by wind type    */
  22.             {
  23.             case (ProcMain):                                /* if main window        */
  24.                 InitCursor();                                /* set arrow cursor        */
  25.             break;
  26.             
  27.             
  28.             case (ProcText):                                /* if text window        */
  29.                 switch (partNo)                                /* where in window?        */
  30.                     {
  31.                     case (inContent):                        /* if in content region    */
  32.                         if (PtInRect(locMouse,                        /* TE view?        */
  33.                             &(**windTbl[windSub].windTEH[0]).viewRect))
  34.                             {                                        /* get I-beam    */
  35.                             theCursor = GetCursor(iBeamCursor);
  36.                             SetCursor (&(**theCursor));                /* set it        */
  37.                             }
  38.                         else                                /* elsewhere in content    */
  39.                             InitCursor();                        /* set arrow        */
  40.                     break;
  41.                     
  42.                     default:                                /* not in content        */
  43.                         InitCursor();                        /* set arrow            */
  44.                     break;        
  45.                     }
  46.             break;                                            /* end of text window    */
  47.  
  48.  
  49.             case (ProcHelp):                                /* if Help window        */
  50.                 InitCursor();                                /* set arrow cursor        */
  51.             break;
  52.             }
  53.         }
  54.     
  55.     else                                                    /* else if not in a wdo    */
  56.     if (partNo)                                                /* if known part number    */
  57.         InitCursor();                                        /* set arrow            */
  58.     
  59.     else
  60.     if (cursorNo)                                            /* else if specific csr    */
  61.         {
  62.         theCursor = GetCursor(cursorNo);                    /* get specific cursor    */
  63.         SetCursor (&(**theCursor));                            /* set it                */
  64.         }
  65.     else                                                    /* if all NIL's            */
  66.         InitCursor();                                        /* set arrow            */
  67.     
  68.     return CSRetCode;                                        /* return                */
  69. }